﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MVCFoto.Master" Inherits="System.Web.Mvc.ViewPage<MVCFoto.Web.ViewData.PhotoDetailViewData>" %>
<%@ Import Namespace="MVCFoto.Web.Utility" %>
<asp:Content ID="changePasswordTitle" ContentPlaceHolderID="TitleContent" runat="server">
   <%=Html.Encode(Model.Photo.Title)%> 
</asp:Content>
<asp:Content ID="jsContent" ContentPlaceHolderID="MetaContent" runat="server">
<script type="text/javascript" src="<%=ResolveUrl("~/Scripts/jquery-1.3.2.min.js") %>"> </script>
<script type="text/javascript" src="<%=ResolveUrl("~/Scripts/thickbox.js") %>"></script>
<script language="javascript" type="text/javascript">
   var _photoId = <%=Model.Photo.PhotoID %>;
   var _IMG_CLEAR = '<%=ResolveUrl("~/content/images/clear.gif") %>';
   var _URL_ADDPHOTOTAGS = '<%=Url.RouteUrl("Ajax",new{action="AddPhotoTags"}) %>';
   var _URL_DELETEPHOTOTAG = '<%=Url.RouteUrl("Ajax",new{action="DeletePhotoTag"}) %>';
   var _URL_EDITPHOTODESC = '<%=Url.RouteUrl("Ajax",new{action="EditPhotoDesc"}) %>';
   var _URL_EDITPHOTOTITLE = '<%=Url.RouteUrl("Ajax",new{action="EditPhotoTitle"}) %>';
   var _URL_UPDATEPHOTOLATLNG = '<%=Url.RouteUrl("Ajax",new{action="UpdatePhotoLatLng"}) %>';
   var _LAT = '<%=Model.Photo.EXIF_Lat %>';
    var _LNG = '<%=Model.Photo.EXIF_Lng %>';
    var map;
</script>
<!--Key for photo.oteam.cn -->
<script src="http://www.google.com/jsapi?key=ABQIAAAAriss5tq-MZc3FYTiB4WoPhQWp4wysEEkhJuBk9s13KIUbHS35xRV2U9GOs2hhkE19xtxhtwxhbnPMA" type="text/javascript"></script> 
<script type="text/javascript" src="<%=ResolveUrl("~/Scripts/photo.js") %>"> </script>
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
 <div class="primaryContent" style="width:550px;">
<div class="breadcrumb"><%=Html.RouteLink(Model.User.UserName,"User",new{userid=Model.User.UserID}) %> /
 <%=Html.RouteLink("相册", "Photos", new { userid = Model.User.UserID })%> / 
  <%=Html.RouteLink(Html.Encode(Model.Album.Title), "Album", new { id = Model.Album.AlbumID })%> / 
 <span style="font-weight: normal;" class="gray"><%=Html.Encode(Model.Photo.Title)%></span>
</div>
<div>
<%if (Model.IsOwner)
  {%>
    <h2 id="h2_photo_title" onclick="edittitle()"> <%=Html.Encode(Model.Photo.Title)%> </h2>
  <%}
  else
  { %>
    <h2> <%=Html.Encode(Model.Photo.Title)%> </h2>
<%} %>
</div>

<%if (Model.Photo == null)
  { %>
  <p>没有这个照片！</p>
<%} %>
 
 <div class="photo_single">
 <a target="_mvcfoto_all" href="<%=Url.RouteUrl("PhotoAllSize",new{id=Model.Photo.PhotoID} )%>"><img border="0" onmouseout="this.src='<%=ResolveUrl("~/content/images/ibtn_all.gif") %>'" onmouseover="this.src='<%=ResolveUrl("~/content/images/ibtn_all_on.gif") %>'" src="<%=ResolveUrl("~/content/images/ibtn_all.gif") %>"/></a>
 <br />
<img src="<%=ResolveUrl(Html.ThumbnailUrl(Model.Photo.Photo,512))%>" alt="<%=Html.Encode(Model.Photo.Title) %>" />

</div>
<div>
<%if (Model.IsOwner)
  {%>   
     <%if (String.IsNullOrEmpty(Model.Photo.Desc))
      { %>
       <em id="span_photo_desc" onclick="editdesc(false)">点击此处为照片添加描述</em>
       <% }
      else
      {%><span id="span_photo_desc" onclick="editdesc(true)"><%=Html.LineBreaks(Model.Photo.Desc)%></span>
<%}
  }
  else
  { %>
    <div><span><%=Html.LineBreaks(Model.Photo.Desc)%></span>
       <%}%></div>
 <!--comment list-->
 <%if (Model.Comments.Count() > 0)
   {
       int index = 1;%>
      <div class="sep"></div>
      <%foreach (MVCFoto.Model.CommentInfo ci in Model.Comments)
        { %>
        <div align="left" class="<%=(index%2 ==0 ?"item_nb_alt":"item_nb") %>">
        <div class="comment-op"><a name="cmt<%=ci.CommentID %>"/>
        <small class="gray">#<%=index++ %></small>
        <%if (MVCFoto.BLL.User.MyID == ci.UserId)
          { %>
        <a onclick="if (confirm('确认删除这条评论？')) { location.href= '<%=Url.RouteUrl("DeleteComment",new{photoid=Model.Photo.PhotoID,commentId=ci.CommentID}) %>'; }" href="#;">
        <img border="0" align="absmiddle" src="<%=ResolveUrl("~/content/images/comment_delete.png") %>"/></a>
        <%} %>
        </div><a href="<%=Url.RouteUrl("User", new { userid = ci.UserId })%>">
        <img border="0" align="absmiddle" class="portrait" src="<%=ResolveUrl(Html.ThumbnailUrl(ci.UserAvatar,32)) %>"/></a>
         <%=Html.RouteLink(ci.UserName, "User", new { userid = ci.UserId })%>在 <small><%=Html.TimeSince(ci.CreateDate)%></small> 说：<br/><br/>
         <%=Html.LineBreaks(ci.Content)%>
         </div>
      <%}
   }%>
  <!--END of comment list-->     
 
       <% if (User.Identity.IsAuthenticated)
          { %> <div class="sep"></div>

    <% using (Html.BeginForm("AddComment", "Photo", new { photoid = Model.Photo.PhotoID }, FormMethod.Post, new { id = "form_addcomment" }))
       {%><img border="0" align="absmiddle" src="<%=ResolveUrl("~/content/images/comment.png") %>"/>
       <span class="gray">我来评论这张照片(<em>最多500个中文</em>)</span>
       <textarea name="comment" id="commentBox"></textarea>
       <p style="text-align:center; margin-top:1em;">
             <button type="submit" id="btn_addcomment" class="submitBtn" onclick="return checkCommentForm()" tabindex="8" value="提交"><span>提交</span></button>
                </p>
<%}
          }%>
</div>
</div>
    <div class="secondaryContent" style="width:200px;">
    <% Html.RenderPartial("RightUserInfo",Model.User); %>
    <div class="sep"></div>
    上传于 <small><%=Html.TimeSince(Model.Photo.CreateDate) %></small><br />
    观赏次数 <small><%=Model.Photo.Views %></small>
    <div class="sep"></div>
      <% Html.RenderPartial("RightAlbumInfo",Model.Album); %>	
	
   <div class="sep"></div>
	<h2>标记</h2><%if (Model.IsOwner)
              { %><div id="div_add_tag" class="inline-block SPRITE_addTagButton" title="添加新标记" ></div><%} %>
    <div class="sep"></div>
	<div id="div_addphototags"><input id="ipt_tags" name="text_tag" class="text_tag" type="text" /><button id="btn_addphototags" class="submitBtn" value="添  加"><span>添  加</span></button></div>
	<%if (Model.Tags.Count() > 0)
   { %>
	<ul class="taglist">
	<%foreach (MVCFoto.Model.TagInfo tag in Model.Tags)
   { %>
	<li><%=Html.RouteLink(Html.Encode(tag.Name),"Tag",new{tag=tag.Name,userid=Model.User.UserID}) %><%if (Model.IsOwner)
                                                   { %><img class="inline-block SPRITE_xbox" title="从该图片删除此标记" src="<%=ResolveUrl("~/content/images/clear.gif") %>" style="-moz-user-select: none;" /><%} %></li>	
	<%} %>
	</ul><div class="sep"></div>
	<%} %>
	
	<img id="exif_toggle" class="exif" src="<%=ResolveUrl("~/content/images/clear.gif") %>"  alt="exif" title="显示/隐藏照片EXIF信息" style="cursor:pointer;" />
	<div id="exif_info">
	    相机型号 <small><%=Model.Photo.EXIF_Camera %></small><br />
生产商 <small><%=Model.Photo.EXIF_Manufacturer %></small><br />
拍摄于 <small><%=Model.Photo.EXIF_DateTime %></small><br />
曝光时间 <small><%=Model.Photo.EXIF_ExposureTime %></small><br />
光圈 <small><%=Model.Photo.EXIF_FNumber %></small><br />
焦距 <small><%=Model.Photo.EXIF_FocalLength %></small><br />
ISO <small><%=Model.Photo.EXIF_ISO %></small><br />
闪光灯 <small><%=Model.Photo.EXIF_Flash %></small><br />
原始宽度 <small><%=Model.Photo.EXIF_Width %></small><br />
原始高度 <small><%=Model.Photo.EXIF_Height %></small><br />
</div>	
	<div class="sep"></div>
	<%if(Model.IsOwner){ %>
	<h2>操作</h2>
	<ul>
	<li class="op-icon set-as-cover"><a href="<%=Url.RouteUrl("SetPhotoAsCover",new{id=Model.Photo.PhotoID}) %>">设为相册封面</a></li>
	<li class="op-icon del-photo"><a href="<%=Url.RouteUrl("DeletePhoto",new{id=Model.Photo.PhotoID}) %>">删除此照片</a></li>
	<li class="op-icon rotate-photo-clockwise"><a href="<%=Url.RouteUrl("RotatePhoto",new{id=Model.Photo.PhotoID,direction="clockwise"}) %>">顺时针旋转照片</a></li>
	<li class="op-icon rotate-photo-anticlockwise"><a href="<%=Url.RouteUrl("RotatePhoto",new{id=Model.Photo.PhotoID,direction="anticlockwise"}) %>">逆时针旋转照片</a></li>
	</ul>
	<%} %>
	<h2>照片位置</h2>	
	<div class="sep"></div>
	<div id="map_canvas" style="width:100%; display:none; overflow:hidden; height:200px"></div>
	<%if(Model.IsOwner){ %>
	<a href="../content/mvcfotomaps.html?TB_iframe=true&height=520&width=720&modal=true" class="thickbox" title="添加/修改照片位置"><img class="SPRITE_map-sm lhcl_spriting_alignMiddle lhcl_spriting_marginRight5" src="<%=ResolveUrl("~/content/images/clear.gif") %>"/>添加/修改位置
	</a>  <%} %>
    
	</div>
</asp:Content>


